home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 February / SGI IRIX 6.5 Complementary Applications 2004 February.iso / dist / cde.idb / usr / dt / share / examples / dtksh / ListPosSel1.z / ListPosSel1
Encoding:
Text File  |  2003-11-18  |  2.8 KB  |  89 lines

  1. #! /usr/dt/bin/dtksh
  2. #
  3. # ListPosSel1
  4. #
  5. # Copyright 2000, Silicon Graphics, Inc.
  6. # ALL RIGHTS RESERVED
  7. # UNPUBLISHED -- Rights reserved under the copyright laws of the United
  8. # States.   Use of a copyright notice is precautionary only and does not
  9. # imply publication or disclosure.
  10. #
  11. # U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
  12. # Use, duplication or disclosure by the Government is subject to restrictions
  13. # as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
  14. # in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
  15. # in similar or successor clauses in the FAR, or the DOD or NASA FAR
  16. # Supplement.  Contractor/manufacturer is Silicon Graphics, Inc.,
  17. # 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
  18. #
  19. # THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
  20. # INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
  21. # DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
  22. # PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
  23. # GRAPHICS, INC.
  24. #
  25. ##########################################################################
  26. #  (c) Copyright 1993, 1994 Hewlett-Packard Company    
  27. #  (c) Copyright 1993, 1994 International Business Machines Corp.
  28. #  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  29. #  (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
  30. #      Novell, Inc.
  31. ##########################################################################
  32.  
  33.  
  34. #
  35. # This sample shell script demonstrates how to create a list widget, and
  36. # also verifies that the XmListPosSelected command works; this command
  37. # returns information about whether an indicated list item is selected.
  38. #
  39.  
  40. integer i
  41.  
  42. # Pushbutton Callback: print the selection state of each list item.
  43. GetSelectionStatus()
  44. {
  45.    i=1
  46.    echo
  47.    while (($i <= 11 )); do
  48.       if XmListPosSelected $LIST $i; then
  49.          echo "Item "$i" is selected"
  50.       else
  51.          echo "Item "$i" is not selected"
  52.       fi
  53.       i=i+1
  54.    done
  55. }
  56.  
  57. ######################### Create the Main UI #################################
  58.  
  59. XtInitialize TOPLEVEL listPosSel1 ListPosSel1 "$0" "$@"
  60. XtSetValues $TOPLEVEL allowShellResize:True
  61.  
  62. XmCreateScrolledList LIST $TOPLEVEL list \
  63.     itemCount:11 \
  64.     items:"item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11" \
  65.     visibleItemCount:15 \
  66.     listSizePolicy:VARIABLE
  67. XtSetValues $LIST \
  68.     selectedItemCount:3 \
  69.     selectedItems:"item2,item4,item6"
  70. XtManageChild $LIST
  71.  
  72. XtRealizeWidget $TOPLEVEL
  73.  
  74. XtCreateApplicationShell TOPLEVEL2 ListPosSel1a TopLevelShell
  75.  
  76. XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
  77.          orientation:HORIZONTAL \
  78.          numColumns:2 \
  79.          packing:PACK_COLUMN 
  80.  
  81. XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
  82.     labelString:"Get Item Selection Status"
  83. XtAddCallback $PB1 activateCallback "GetSelectionStatus"
  84.  
  85. XtRealizeWidget $TOPLEVEL2
  86.  
  87. XtMainLoop
  88.